<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"/>
    <title>首页 - 光年(Light Year Admin)后台管理系统模板</title>
    <link rel="icon" href="favicon.ico" type="image/ico">
    <meta name="keywords" content="LightYear,光年,后台模板,后台管理系统,光年HTML模板">
    <meta name="description" content="LightYear是一个基于Bootstrap v3.3.7的后台管理系统的HTML模板。">
    <meta name="author" content="yinqi">

    <link th:href="@{/admin/css/bootstrap.min.css}" type="text/css" rel="stylesheet">
    <link th:href="@{/admin/css/materialdesignicons.min.css}" type="text/css" rel="stylesheet">
    <link th:href="@{/admin/css/style.min.css}" type="text/css" rel="stylesheet">

</head>

<body>
<div class="lyear-layout-web">
    <div class="lyear-layout-container">
        <!--左侧导航-->
        <aside class="lyear-layout-sidebar">

            <!-- logo -->
            <div id="logo" class="sidebar-header">
                <a th:href="@{/manage/index}"><img src="/admin/images/logo-sidebar.png" title="LightYear"
                                                   alt="LightYear"/></a>
            </div>
            <div class="lyear-layout-sidebar-scroll">

                <nav class="sidebar-main">
                    <ul class="nav nav-drawer">
                        <li class="nav-item active">
                            <a th:href="@{/manage/index}"><i class="mdi mdi-home"></i>后台首页</a>
                        </li>
                        <li class="nav-item ">
                            <a th:href="@{/manage/toNovel}"><i class="mdi mdi-book-open"></i> 书籍管理</a>
                        </li>
                        <li class="nav-item ">
                            <a th:href="@{/manage/recharge}"><i class="mdi mdi-diamond"></i> 充值管理</a>
                        </li>
                        <li class="nav-item ">
                            <a th:href="@{/manage/toComment}"><i class="mdi mdi-record"></i> 评论管理</a>
                        </li>
                        <li class="nav-item ">
                            <a th:href="@{/manage/toPassApply}"><i class="mdi mdi-compass"></i> 审批作家</a>
                        </li>
                        <li class="nav-item ">
                            <a th:href="@{/manage/system/param}"><i class="mdi mdi-brightness-5"></i> 系统设置</a>
                        </li>
                        <li class="nav-item ">
                            <a th:href="@{/manage/system/log}"><i class="mdi mdi-grease-pencil"></i> 系统日志</a>
                        </li>
                    </ul>
                </nav>
            </div>

        </aside>
        <!--End 左侧导航-->

        <!--头部信息-->
        <header class="lyear-layout-header">

            <nav class="navbar navbar-default">
                <div class="topbar">

                    <div class="topbar-left">
                        <div class="lyear-aside-toggler">
                            <span class="lyear-toggler-bar"></span>
                            <span class="lyear-toggler-bar"></span>
                            <span class="lyear-toggler-bar"></span>
                        </div>
                        <span class="navbar-page-title"> 充值管理 </span>
                    </div>

                    <ul class="topbar-right">
                        <li class="dropdown dropdown-profile">
                            <a href="javascript:void(0)" data-toggle="dropdown">
                                <img class="img-avatar img-avatar-48 m-r-10" th:src="${session.loginUser.imgSrc}"
                                     alt="笔下光年"/>
                                <span th:text="${session.loginUser.userName}"> <span class="caret"></span></span>
                            </a>
                            <ul class="dropdown-menu dropdown-menu-right">
                                <li><a th:href="@{/manage/toInfo}"><i class="mdi mdi-account"></i> 个人信息</a></li>
                                <li><a th:href="@{/manage/toChangePwd}"><i class="mdi mdi-lock-outline"></i> 修改密码</a>
                                </li>
                                <li><a th:href="@{/index}"><i class="mdi mdi-lock-outline"></i> 回到门户网站</a>
                                </li>
                                <li class="divider"></li>
                                <li><a th:href="@{/manage/logout}"><i class="mdi mdi-logout-variant"></i> 退出登录</a>
                                </li>
                            </ul>
                        </li>
                    </ul>

                </div>
            </nav>

        </header>
        <!--End 头部信息-->

        <!--页面主要内容-->
        <main class="lyear-layout-content">

            <div class="container-fluid">

                <div class="row">

                    <div class="col-lg-12">
                        <div class="card">
                            <div style="font-size: 18px;
                            padding-top: 15px;padding-bottom: 15px;padding-left: 50px;color: #0C0C0C;border-bottom: 2px"
                                 class="acc-top-tab">

                                <a href="/manage/recharge" style="margin-right: 15px;color: black">充值数额</a>|
                                <a href="/manage/recharge/toAdd" style="margin-left: 15px">新增充值数额</a>
                            </div>
                        </div>
                    </div>


                    <div class="col-lg-12">
                        <div class="card">
                            <div class="card-toolbar clearfix">
                                <div class="toolbar-btn-action">
                                    <a class="btn btn-primary m-r-5" href="/manage/recharge/toAdd"><i
                                            class="mdi mdi-plus"></i> 新增</a>
                                    <a class="btn btn-danger" onclick="deleteRechargeItem()"><i
                                            class="mdi mdi-window-close"></i> 删除</a>
                                </div>
                            </div>
                            <div class="card-body">

                                <div class="table-responsive">
                                    <table class="table table-bordered">
                                        <thead>
                                        <tr>
                                            <th>
                                                <label class="lyear-checkbox checkbox-primary">
                                                    <input type="checkbox"
                                                           id="check-all"><span></span>
                                                </label>
                                            </th>
                                            <th>充值金额</th>
                                            <th>获取虚拟币数量</th>
                                            <th>创建时间</th>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        <tr th:each="page : ${pageInfo.list}">
                                            <td>
                                                <label class="lyear-checkbox checkbox-primary">
                                                    <input type="checkbox" name="ids[]"
                                                           th:value="${page.id}"><span></span>
                                                </label>
                                            </td>

                                            <td th:text="${page.cost}">1</td>
                                            <td th:text="${page.balance}">第01章 天涯思君不可忘</td>
                                            <td th:text="${#dates.format(page.createdTime,'yyyy-MM-dd HH:mm')}">

                                        </tr>

                                        </tbody>
                                    </table>
                                </div>


                                <div class="modal-footer no-margin-top">
                                    <ul class="pagination pull-right no-margin">

                                        <li th:if="${pageInfo.hasPreviousPage}">
                                            <a th:href="'/manage/recharge?pageNum=1'">首页</a>
                                        </li>

                                        <li class="prev" th:if="${pageInfo.hasPreviousPage}">
                                            <a th:href="'/manage/recharge?pageNum='+${pageInfo.prePage}">
                                                <i class="ace-icon fa fa-angle-double-left">上一页</i>
                                            </a>
                                        </li>
                                        <!--遍历条数-->
                                        <li th:each="nav:${pageInfo.navigatepageNums}">
                                            <a th:href="'/manage/recharge?pageNum='+${nav}" th:text="${nav}"
                                               th:if="${nav != pageInfo.pageNum}"></a>
                                            <span style="font-weight: bold;background: #6faed9;"
                                                  th:if="${nav == pageInfo.pageNum}" th:text="${nav}"></span>
                                        </li>

                                        <li class="next" th:if="${pageInfo.hasNextPage}">
                                            <a th:href="'/manage/recharge?pageNum='+${pageInfo.nextPage}">
                                                <i class="ace-icon fa fa-angle-double-right">下一页</i>
                                            </a>
                                        </li>

                                        <li>
                                            <a th:href="'/manage/recharge?pageNum='+${pageInfo.pages}">尾页</a>
                                        </li>
                                    </ul>

                                </div>

                            </div>
                        </div>


                    </div>

                </div>

            </div>

        </main>
        <!--End 页面主要内容-->
    </div>
</div>
<script type="text/javascript" th:src="@{/admin/js/jquery.min.js}"></script>
<script type="text/javascript" th:src="@{/admin/js/bootstrap.min.js}"></script>
<script type="text/javascript" th:src="@{/admin/js/perfect-scrollbar.min.js}"></script>
<script type="text/javascript" th:src="@{/admin/js/main.min.js}"></script>
<script type="text/javascript" th:src="@{/js/common.js}"></script>
<script type="text/javascript">

    //删除充值数据类型
    function deleteRechargeItem() {
        let id = getCheckId();
        if (id) {
            let flag = confirm("你确定要删除这条充值数额吗?");
            if (flag) {
                $.ajax({
                    url: "/manage/recharge/delete",
                    method: "post",
                    data: {'id': id},
                    dataType: "json",
                    success: function (result) {
                        if (result == true) {
                            alert("操作成功!");
                            location.reload();
                        } else if (result == false) {
                            alert("操作失败!");
                        } else {
                            alert(result.message);
                            if (result.message == '权限校验失败!') {
                                window.location.href = "/index";
                            }
                        }
                    }
                })
            }
        } else {
            alert("请勾选待处理的记录，且每次只能勾选一个");
        }
    }

</script>
</body>
</html>